<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户管理</title>
    <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" th:src="@{/js/jquery-1.12.4.js}"></script>
    <script type="text/javascript">
        function deltipOpen(ele) {
            $("#deltip").fadeIn(200);
            $("#orderid2").val($(ele).prev().val());
        }

        function deltipClose() {
            $("#deltip").fadeOut(200);
        }
        function deltipQueding() {
            $("#deltip").fadeOut(200);
            var orderid = $("#orderid2").val();
            window.location.href="/erp/market/order/delOrders?orderid="+orderid;
        }

        function examinetipOpen(ele) {
            $("#examinetip").fadeIn(200);
            var oid = $(ele).prev().val();
            $("#oid2").val(oid);
        }

        function examinetipclose() {
            $("#examinetip").fadeOut(200);
        }

        function examinetipQueding() {
            $("#examinetip").fadeOut(200);
            var oid = $("#oid2").val();
            var uid = $("#uid").val();
            window.location.href="/erp/market/order/editStatus?orderid="+oid+"&uid="+uid;
        }
    </script>
</head>

<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li>营销管理</li>
        <li>订购单管理</li>
        <li>基本内容</li>
    </ul>
</div>
<div class="rightinfo">
    <form id="form" action="/erp/market/order/findPageAll" method="get">
        <input type="hidden" id="pageNum" name="pageNum"/>
        <ul class="tools">
            <li> 订单编号:
                <input placeholder="请输入编号" type="text" name="orderid" th:value="${orders==null?'':orders.orderid}"/>
            </li>
            <li> 客户姓名:
                <input placeholder="请输入姓名" type="text" name="customname" th:value="${customname}"/>
            </li>
            <li> 订购时间:
                <input type="date" name="datemin" th:value="${dateMin}"/>
                -
                <input type="date" name="datemax" th:value="${dateMax}"/>
            </li>

            <li> 金额:
                <input placeholder="0.0" type="text" class="stinput" name="priceMin" th:value="${priceMin}"/>
                -
                <input placeholder="0.0" type="text" class="stinput" name="priceMax" th:value="${priceMax}"/>
            </li>
            <li> 审核状态：
                <select name="status">
                    <option value="0">请选择</option>
                    <option value="1" th:selected="${orders==null?false:orders.status==1}">未审核</option>
                    <option value="2" th:selected="${orders==null?false:orders.status==2}">审核中</option>
                    <option value="3" th:selected="${orders==null?false:orders.status==3}">审核通过</option>
                    <option value="4" th:selected="${orders==null?false:orders.status==4}">审核未通过</option>
                </select>
            </li>
            <li class="subBut" onclick="tiaoZhuan(1)"><img th:src="@{/images/t06.png}"/>查询</li>
            <li class="subBut" onclick="window.location.href='orderAdd.html'"><img th:src="@{/images/t01.png}"/>添加</li>
            <li class="subBut" onclick="qingkong()"><img th:src="@{/images/t03.png}"/>重置</li>
            <script>
                function qingkong() {
                    $("input[name=datemin]").val("");
                    $("input[name=datemax]").val("");
                    $("input[name=orderid]").val("");
                    $("input[name=customname]").val("");
                    $("input[name=priceMin]").val("");
                    $("input[name=priceMax]").val("");
                    $("select[name=status]>option:eq(0)").prop("selected",true);
                }
            </script>
        </ul>
        <table class="tablelist">
            <thead>
            <tr>
                <th>序号</th>
                <th>订单编号</th>
                <th>客户姓名</th>
                <th>联系电话</th>
                <th>订购时间</th>
                <th>金额</th>
                <th>操作人</th>
                <th>审核状态</th>
                <th>审核人</th>
                <th>审核时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="o,i :${pb.list}">
                <td th:text="${(pb.pageNum-1)*pb.pageSize+i.count}">1</td>
                <td th:text="${o.orderid}">DJ201701270001</td>
                <td th:text="${o.customid==null?'':o.custom.customname}">王金平</td>
                <td th:text="${o.customid==null?'':o.custom.telephone}">17370899727</td>
                <td th:text="${o.ordertime}">2017-01-25 15:05:05</td>
                <td th:text="'￥'+${o.ordermoney}">9,876,582</td>
                <td th:text="${o.operatorUser.uname}">关羽</td>
                <td th:if="${(o.status==1)}">未审核</td>
                <td th:if="${(o.status==2)}">审核中</td>
                <td th:if="${(o.status==3)}">审核通过</td>
                <td th:if="${(o.status==4)}">审核不通过</td>
                <td th:text="${o.checkid==null?'':o.checkUser.uname}"></td>
                <td th:text="${o.chectime}"></td>
                <td>
                    <a th:if="${o.status!=4}" th:href="@{'/market/order/findByDetails?orderid='+${o.orderid}}" class="tablelink">查看详情</a>
                    <a th:if="${o.status==1 || o.status==4}" th:href="@{'/market/order/goEditOrders?orderid='+${o.orderid}}" class="tablelink">修改</a>
                    <input type="hidden" th:value="${o.orderid}" />
                    <a th:if="${o.status==1}" href="javascript:void(0);" class="tablelink" onclick="deltipOpen(this)">删除</a>
                    <input th:value="${o.orderid}" type="hidden"/>
                    <a th:if="${o.status==1 || o.status==4}" href="javascript:void(0);" class="tablelink"
                       onclick="examinetipOpen(this)">提交审核</a>
                    <a th:if="${o.status==3}" th:href="@{'/market/order/outWarehouseBy?orderid='+${o.orderid}}" class="tablelink" >出库详情</a>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="pagin">
            <div class="message">共<i class="blue" th:text="${pb.total}">1256</i>条记录，当前显示第&nbsp;<i class="blue"
                                                                                                  th:text="${pb.pageNum}">2&nbsp;</i>页
            </div>
            <ul class="paginList">
                <li class="paginItem">
                    <a href="javascript:void(0);" th:onclick="tiaoZhuan([[${pb.isFirstPage?1:pb.pageNum-1}]])">
                        <span th:class="${pb.isFirstPage?'pagepre':'pagenxt roate'}"></span>
                    </a>
                </li>

                <li class="paginItem" th:if="${1+4<=pb.pageNum}"><a th:onclick="tiaoZhuan(1)"
                                                                    href="javascript:void(0);">1</a></li>
                <li class="paginItem more" th:if="${1+5<=pb.pageNum}"><a href="javascript:void(0);">...</a></li>
                <li class="paginItem" th:if="${1+3<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-3}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-3}">3</a></li>
                <li class="paginItem" th:if="${1+2<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-2}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-2}">4</a></li>
                <li class="paginItem" th:if="${1+1<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-1}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-1}">1</a></li>

                <li class="paginItem current"><a href="javascript:void(0);" th:text="${pb.pageNum}">2</a></li>

                <li class="paginItem" th:if="${pb.pages-1>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+1}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+1}">3</a></li>
                <li class="paginItem" th:if="${pb.pages-2>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+2}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+2}">4</a></li>
                <li class="paginItem" th:if="${pb.pages-3>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+3}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+3}">5</a></li>
                <li class="paginItem more" th:if="${pb.pages-5>=pb.pageNum}"><a href="javascript:void(0);">...</a></li>
                <li class="paginItem" th:if="${pb.pages-4>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pages}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pages}">10</a></li>

                <li class="paginItem">
                    <a href="javascript:void(0);" th:onclick="tiaoZhuan([[${pb.isLastPage?pb.pages:pb.pageNum+1}]])">
                        <span th:class="${pb.isLastPage?'pagepre roate ':'pagenxt '}"></span>
                    </a>
                </li>
            </ul>
        </div>
    </form>
    <script>
        function tiaoZhuan(pageNum) {
            $("#pageNum").val(pageNum);
            $("#form").submit();
        }
    </script>
    <!-- 删除提示框 -->
    <div id="deltip" class="tip">
        <div class="tiptop"><span>提示信息</span><a onclick="deltipClose()"></a></div>
        <div class="tipinfo"><span><img th:src="@{/images/ticon.png}"/></span>
            <div class="tipright">
                <p>是否确认删除此条信息？</p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite></div>
        </div>
        <div class="tipbtn">
            <input type="hidden" id="orderid2" />
            <input name="" type="button" class="sure" value="确定" onclick="deltipQueding()"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="deltipClose()"/>
        </div>
    </div>

    <!-- 审批提示框 -->
    <div id="examinetip" class="tip">
        <div class="tiptop">
            <span>提示信息</span><a onclick="examinetipclose()"></a>
        </div>
        <div class="tipinfo1">

            部门：
            <select class="dfselect" disabled="disabled">
                <option>请选择</option>
                <option selected>市场部</option>
                <option>采购部</option>
                <option>财务部</option>
            </select>
            <p/>
            职位：
            <select class="dfselect" disabled="disabled">
                <option>请选择</option>
                <option selected>部门经理</option>
            </select>
            <p/>
            姓名：
            <select class="dfselect" id="uid">
                <option>请选择</option>
                <option th:each="u :${userList}" th:text="${u.uname}" th:value="${u.uId}"></option>
            </select>
            <p/>
        </div>
        <div class="tipbtn">
            <input type="hidden" id="oid2"/>
            <input name="" type="button" class="sure" value="确定" onclick="examinetipQueding()"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="examinetipclose()"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
